package cn.iocoder.yudao.module.product.favorite.controller.admin;

import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.product.favorite.service.AdminProductFavoriteService;
import cn.iocoder.yudao.module.product.favorite.vo.AdminProductFavoriteQueryDTO;
import cn.iocoder.yudao.module.product.favorite.vo.AdminProductFavoriteVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 产品收藏")
@RestController
@RequestMapping("/product/favorite")
@Validated
public class ProductFavoriteController implements PageController<AdminProductFavoriteVO, AdminProductFavoriteQueryDTO> {

    @Resource
    private AdminProductFavoriteService adminProductFavoriteService;

    @PreAuthorize("@ss.hasPermission('product:favorite:query')")
    @Override
    public CommonResult<PageResult<AdminProductFavoriteVO>> getPage(Integer pageNo, Integer pageSize, AdminProductFavoriteQueryDTO param) {
        PageResult<AdminProductFavoriteVO> pageResult = adminProductFavoriteService.getPage(pageNo, pageSize, param);
        return success(pageResult);
    }

}
